Skip to content

fix(pgvector): target x86-64-v2 for CPU portability#1

Open
yajo wants to merge 5 commits into
masterfrom
pgvector-arch
Open

fix(pgvector): target x86-64-v2 for CPU portability#1
yajo wants to merge 5 commits into
masterfrom
pgvector-arch

Conversation

@yajo

@yajo yajo commented Jun 15, 2026

Copy link
Copy Markdown
Member

This is a draft PR forcing to build and push an image for us to test it while upstream decides to merge Tecnativa#38. When merged, this can be closed.

@moduon MT-14612

ljmnoonan and others added 5 commits July 6, 2026 14:51
Base for Postgres 14-18 was bumped from alpine v3.23 to v3.24 in
docker-library/official-images@769849f

Alpine v3.24 dropped support for clang19/llvm19, which caused
pgvector-build to fail for versions 14 and up.

As it turns out, using hardcoded clang19/llvm19 was already not the best idea
as it did not match the version used by postgres itself. Only postgres 13
uses clang19 and llvm19, everything above uses clang21 and llvm21.

Also, pgvector 0.8.1 does not support pg12
https://github.com/pgvector/pgvector/blob/fb1b8966ebb9254032b6d0e7a594fdcc86f8efcc/CHANGELOG.md?plain=1#L34

Ultimately, I beleive pgvector was only properly installed in a few versions.
This commit makes sure it is installed from 13 upwards and also tests that
it is installed and working.
Fork PRs previously skipped the build-test-push job entirely,
preventing contributors from getting build and test feedback.

The GHCR push step used || between independent secrets:
BOT_TOKEN || GITHUB_TOKEN and BOT_LOGIN || repository_owner.
When only one BOT_* secret was set, credentials became a mismatched
pair, causing a denied: denied authentication failure from ghcr.io.

Changes:
- Remove same-repo restriction from job condition so all PRs
  run the pipeline.
- Use && to ensure both BOT_TOKEN and BOT_LOGIN must exist
  together to be used; otherwise fall back to the always-
  available GITHUB_TOKEN + github.repository_owner pair.
- Expose BOT_TOKEN and BOT_LOGIN as env vars so they can be
  evaluated in the if: condition.
- Allow GHCR push on fork PRs when bot credentials are
  available; skip only when GITHUB_TOKEN would be read-only
  (fork PR without BOT_TOKEN/BOT_LOGIN).
- Use github.repository_owner as fallback username instead of
  github.actor to avoid confusion in org fork scenarios.
ci: run build-test-push on all PRs, not just same-repo
Without explicit CFLAGS, make detects the host CPU features (e.g. AVX-512)
and generates a .so that crashes with "signal 4: Illegal instruction"
on older x86-64 CPUs.

Pinning -march=x86-64-v2 ensures compatibility with any x86-64
processor from the last ~15 years.

Without this patch, for example you cannot install PGVector if your server
runs an Intel® i9-13900 processor.

ARM64 builds are not affected.

@moduon MT-14612
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants